package org.teamswift.crow.rbac.entity;

import lombok.Data;
import org.teamswift.crow.rbac.enums.CrowResourceActions;
import org.teamswift.crow.rest.common.ICrowIO;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Data
public class CrowPermissionResource implements ICrowIO {

    private String id;

    private String resource;

    private String category;

    private Set<String> supportedActions = new HashSet<>(){{
            add(CrowResourceActions.MANAGE.name());
            add(CrowResourceActions.GET.name());
    }};

    private boolean supportRowManagement = false;

    public String getId() {
        return resource;
    }

    public void addSupportedActions(String action) {
        this.supportedActions.add(action);
    }
}
